<template>
    <div>
        <!-- 添加按钮 -->
        <el-button type="primary" @click="willAdd">添加</el-button>

        <!-- 列表 -->
        <list-vue :list="list" @init="init" @willEdit="willEdit"></list-vue>

        <!-- 弹框 -->
        <form-vue :list="list" :info="info" @init="init" ref="form"></form-vue>
    </div>
</template>
<script>
import { mapGetters, mapActions } from "vuex";
import formVue from "./components/form.vue";
import listVue from "./components/list.vue";
import {reqmenulist} from "../../http/api"
import {toggle} from "../../mixins/mixins"
export default {
    components:{
        listVue,
        formVue
    },
    props: [],
    mixins:[toggle],
    data() { 
        return {
            list:[],
        } 
        },
    computed: {
        ...mapGetters({}),
    },
    mounted() {
        this.init();
    },
    methods: {
        ...mapActions({}),
        // //获取列表
        init(){
            reqmenulist({istree:true}).then((res)=>{
                if(res.data.code==200){
                    this.list = res.data.list
                }
        })
        },
    },
};
</script>
<style scoped lang="less">
@import "../../less/index.less";
</style>